UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zxUgpf1g44tacKcOUvd0pzcH0K0it5W1q+1CXuolI6M=' 
WHERE 
  key_id = '2a95142d2748624eaa7e14f4bee71c3e8f443a7a15b42648b0c8b33be1365232' 
  AND (
    token = 'zxUgpf1g44tacKcOUvd0pzcH0K0it5W1q+1CXuolI6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032