UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w1NxDmcA6xho+2TWXiOAvUUxvShIR2zTNt6soyy419Q=' 
WHERE 
  key_id = 'c37ff8e7bde9e3347646cf82016c257fc3aefb0e0dcf90dab154575ddc283c24' 
  AND (
    token = 'w1NxDmcA6xho+2TWXiOAvUUxvShIR2zTNt6soyy419Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025