UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5znSn/rMcYfty7ZOPHXz0TBZzKydMV1Uxil9peNdZzs=' 
WHERE 
  key_id = 'ed588e18ead8525e576ccaa635b48ed4eb83ff82fa91f765674cb9c3e6ba712c' 
  AND (
    token = '5znSn/rMcYfty7ZOPHXz0TBZzKydMV1Uxil9peNdZzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00087