UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XolcByAH7fu6dP675JrRwOjnMD/EoKu3roM2PskgZhU=' 
WHERE 
  key_id = '1c6880a2ecbbe084bf78b9f36b1b798497f9d31b99df9a677af2c58b4c181099' 
  AND (
    token = 'XolcByAH7fu6dP675JrRwOjnMD/EoKu3roM2PskgZhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023