UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JtZ4OqD5zaNWDaH9Qy7sRHRap5vRYqPSz5V8htpAs9w=' 
WHERE 
  key_id = '27b78f2cf08cc194e0fc6fcf9884349bb0a6a89db36a0f5c4a56be603dd4e2d3' 
  AND (
    token = 'JtZ4OqD5zaNWDaH9Qy7sRHRap5vRYqPSz5V8htpAs9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032