UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1JADcvxFKb44+eShpl7LmylVJSgCPGrn/aSUW6j6xvY=' 
WHERE 
  key_id = 'ad548b3135adb1c45ac83f802b1789f6b1bf39d3ab32e891042e480228dd9a0e' 
  AND (
    token = '1JADcvxFKb44+eShpl7LmylVJSgCPGrn/aSUW6j6xvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050