UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V7rUtU4KYbNuf4fw21CS4ySV/LgDu2EeAHoe10sf09Y=' 
WHERE 
  key_id = '5f14acbf4fba31f9f64d944e6e9a6893abd6c9dcab72ffad61dcd45804ed9307' 
  AND (
    token = 'V7rUtU4KYbNuf4fw21CS4ySV/LgDu2EeAHoe10sf09Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023