UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uUZqbnd0HQqrL7Z65xEQF76dTy3BOuWDtmyQOW9rI2M=' 
WHERE 
  key_id = '5d5605dad895fcf8b15e65240f4fe1b988d2bc8ec1c478255c97e9ad1957f1a5' 
  AND (
    token = 'uUZqbnd0HQqrL7Z65xEQF76dTy3BOuWDtmyQOW9rI2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026