UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HPRDe/GBjMABHS8Hf7BPBpLb4b6H19QwrBzZYC30YXA=' 
WHERE 
  key_id = 'dbb346b2fb67022b7bd3f630210bb5077e776358fcdab113a85e56d4c0250838' 
  AND (
    token = 'HPRDe/GBjMABHS8Hf7BPBpLb4b6H19QwrBzZYC30YXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029