UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9g7OzgtH7TMeAkD8LADK1LqwS1v/3ytN+tW7FJPd52s=' 
WHERE 
  key_id = 'fa284e0033f39b06b14502c3223c7aea84eff2c694f98b44ba2aef24e0018266' 
  AND (
    token = '9g7OzgtH7TMeAkD8LADK1LqwS1v/3ytN+tW7FJPd52s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030