UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QiyJHEDtIsheX5xhQFg+RlRi+8tvCodRXzIHA8R5PNM=' 
WHERE 
  key_id = '046b3ae321d9aa5a3697d76d90254362843cb05b8220e15bbbf706bf424b25c6' 
  AND (
    token = 'QiyJHEDtIsheX5xhQFg+RlRi+8tvCodRXzIHA8R5PNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040