UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KhTlZxQRfrcqhXrsB6VjAKztoi26UcDddQdPQDj1MH0=' 
WHERE 
  key_id = '4121343c2de0dfef54daa1729be9c6f538311ec6a1aee878d7f93e72ae538eaf' 
  AND (
    token = 'KhTlZxQRfrcqhXrsB6VjAKztoi26UcDddQdPQDj1MH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032