UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W7QDKU2t0ZQK3Qo5EYtEtfY707AOVPlqzjMcWYzn+GA=' 
WHERE 
  key_id = '882ff63454e396b71d3288157becd98f485c6c0199861541cb4e3337ac7b4b4a' 
  AND (
    token = 'W7QDKU2t0ZQK3Qo5EYtEtfY707AOVPlqzjMcWYzn+GA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028