UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qD0jjBU5kjNcnmP1mSJXlgF+IlfWdhIKhs7D78OlPKQ=' 
WHERE 
  key_id = '38d113010e282a840a190776f5c1ab016d647f76de3dab451c8a1a052bca2e5d' 
  AND (
    token = 'qD0jjBU5kjNcnmP1mSJXlgF+IlfWdhIKhs7D78OlPKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037