UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q7MMiXejVvDXgCkQB7nJ2BBu4kIwXx7KZbBingI+Z/o=' 
WHERE 
  key_id = '8eaf8becf1155d76ec4e4a1c984719be6d0b5081b1bf297016873ef40efa735d' 
  AND (
    token = 'q7MMiXejVvDXgCkQB7nJ2BBu4kIwXx7KZbBingI+Z/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025