UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBbwQqL66DtlqS7cRlX2T8zyvQWMjNgaeM2ZxTdIVZw=' 
WHERE 
  key_id = '3367f8aa4d4be5924a54d7f8ffe257f3dc4029b44ed84bd1504655c49bf2a38f' 
  AND (
    token = 'dBbwQqL66DtlqS7cRlX2T8zyvQWMjNgaeM2ZxTdIVZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026