UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IYjc4/bp9+WvzhRdjoyxc1sv9lTqXbqsoVIH381Hq8o=' 
WHERE 
  key_id = '7f95b7e34ff15d1c4a3abd591f3a2788742d305bd997bb288114aaab8e2107cb' 
  AND (
    token = 'IYjc4/bp9+WvzhRdjoyxc1sv9lTqXbqsoVIH381Hq8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033