UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OZocl2Oo3fa6kISiInXGZ89qFwtXVCFdEveYaACVDUY=' 
WHERE 
  key_id = 'e51389e1a1f81179438547736957b189046726fff0b035e4218860e5882b60c0' 
  AND (
    token = 'OZocl2Oo3fa6kISiInXGZ89qFwtXVCFdEveYaACVDUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026