UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7nPMDXFFQGorgnq3rldKA1cm53FKuKXzUbCSWOYU1/0=' 
WHERE 
  key_id = '1d348118146cb1365123dd78b7e4ee30cd38f230bf86da524047e997b79d7940' 
  AND (
    token = '7nPMDXFFQGorgnq3rldKA1cm53FKuKXzUbCSWOYU1/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047