UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tyIAEfXI9lZOt9BBrXSYEcL/hisKKnCMuGlUrydiBGM=' 
WHERE 
  key_id = 'e7cf1795707632de9b91c89d0a5299e79bd47c737eba14acc12a3c549c7910be' 
  AND (
    token = 'tyIAEfXI9lZOt9BBrXSYEcL/hisKKnCMuGlUrydiBGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032