UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xh2oTK+vZN7Mp+WoVjudvBzedIbibRRSfzINx062zOA=' 
WHERE 
  key_id = '7e5b47616e7fddf94d2b2632f5c9cc4d7eb9d66393ee4003275896d4b906f246' 
  AND (
    token = 'xh2oTK+vZN7Mp+WoVjudvBzedIbibRRSfzINx062zOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023