UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kv06y5u4wYEV0UrNzo7182Br5iuToGPbzmm5GCCtF7s=' 
WHERE 
  key_id = '4986914200ed61dd0c47b3dd500a881f077b480f33f4182fc713238263cde144' 
  AND (
    token = 'Kv06y5u4wYEV0UrNzo7182Br5iuToGPbzmm5GCCtF7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041