UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sCQZCG0BoQbCtcN/zWEcdQy2Gefzf/ThhCCkf+aHi+g=' 
WHERE 
  key_id = '7eea01d1984cbc78549d62446a45194a4c797feacf474d363ea57b35de318f97' 
  AND (
    token = 'sCQZCG0BoQbCtcN/zWEcdQy2Gefzf/ThhCCkf+aHi+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026