UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cOOxl3vJ6diL4lGW87HjCt6SwrZL83LUEH121wRc+ME=' 
WHERE 
  key_id = '08475a64a91401a7e170a25ea0d06fd15c960b9fbdc04cd350fbb577cc5e28ac' 
  AND (
    token = 'cOOxl3vJ6diL4lGW87HjCt6SwrZL83LUEH121wRc+ME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030