UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ncCFe9fyVcjXSHb2nFhAkd1uJsMSpXmN8w47MVi9iag=' 
WHERE 
  key_id = '6e975e8ca506c98412fc3a861ced0399e8924e96fc21d5b61958c39b10018e17' 
  AND (
    token = 'ncCFe9fyVcjXSHb2nFhAkd1uJsMSpXmN8w47MVi9iag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028