UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'goFPHwQseysNuRXdggI6a4K2mIwbMaeN9oph+xk/YRs=' 
WHERE 
  key_id = '59b8d13dd8a54678ce86ec3068ed44e3490eb248a14eef9ebfaaaa14ad5ac2e4' 
  AND (
    token = 'goFPHwQseysNuRXdggI6a4K2mIwbMaeN9oph+xk/YRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031