UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gMZTt45Yu+0NLWg2++iP2V8cU+4/1gKxZMdePfgLLuo=' 
WHERE 
  key_id = '24eaced1ad751f6afb0924cc89b2cfba306b22f0a2a98645f936d3cfaf20a759' 
  AND (
    token = 'gMZTt45Yu+0NLWg2++iP2V8cU+4/1gKxZMdePfgLLuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038