UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mz8Jl/HFlv0BoeP2wRe/iA25VkYIOFCD9qgCdcdOKyM=' 
WHERE 
  key_id = 'fecafc4786105debf6879f77d0de4da559428577400ef84be7f91aaee6fb1094' 
  AND (
    token = 'Mz8Jl/HFlv0BoeP2wRe/iA25VkYIOFCD9qgCdcdOKyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037