UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uEBtjhks7baf/ErZUYpiPXQytzWNzDVdFHA0IhxKefY=' 
WHERE 
  key_id = '38fe6670fb189ec4738d3426083ad350cf0ddbd52ef503c12cb01f662e076bba' 
  AND (
    token = 'uEBtjhks7baf/ErZUYpiPXQytzWNzDVdFHA0IhxKefY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047