UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '05LJQ2F5rEPMBE6U+wyuEA2WT5lCBlu6MFxTHqWJ5ZM=' 
WHERE 
  key_id = '106347fc14da475835cfab4287d801583de3378baee70ecce3e85734fe4c604a' 
  AND (
    token = '05LJQ2F5rEPMBE6U+wyuEA2WT5lCBlu6MFxTHqWJ5ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052