UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YVjP4ZDXrSC8qu+dStWXvmD2jinQjWaiPpZzOk/zqwo=' 
WHERE 
  key_id = '447554c79ea61671334fb10fce4b7687f0d5f50ac3fb643d522328aad1901718' 
  AND (
    token = 'YVjP4ZDXrSC8qu+dStWXvmD2jinQjWaiPpZzOk/zqwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037