UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YHcL2UccORmjcTcwQSjvw4XjvcynejAmbLkgczDLU8Y=' 
WHERE 
  key_id = '2a44accef2fc84f65de2bbbc13c61b8e205b50b23d9512dfa2e96a90f4ecd008' 
  AND (
    token = 'YHcL2UccORmjcTcwQSjvw4XjvcynejAmbLkgczDLU8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035