UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L7qfvA55gl/AQkwMMBHOy2nNLDlqD5LTOEI0gfXRDmY=' 
WHERE 
  key_id = 'dcb488024ff68725dc5995d0ff27dce9b5804bd27b057494dec9588572914a72' 
  AND (
    token = 'L7qfvA55gl/AQkwMMBHOy2nNLDlqD5LTOEI0gfXRDmY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035